package com.xuecheng.search.service;

import com.xuecheng.commons.model.dto.CoursePubIndexDto;
import com.xuecheng.commons.model.dto.PageRequest;
import com.xuecheng.commons.model.vo.PageResponseResult;
import com.xuecheng.commons.model.vo.ResponseResult;
import com.xuecheng.web.exceptions.BusinessException;

import java.io.IOException;

public interface SearchService {
    /**
     * 搜索课程
     * @param coursePubIndexDto 搜索条件
     * @param pageRequest 分页数据
     * @return 结果
     */
    PageResponseResult findCourseByEs(CoursePubIndexDto coursePubIndexDto, PageRequest pageRequest) throws IOException;

    /**
     * 同步Es索引库
     * @param coursePubId 课程发布id
     */
    void cogradientIndex(Long coursePubId) throws BusinessException, IOException;

    /**
     * 根据id从Es索引库中查询
     * @param id id
     * @return 结果
     */
    ResponseResult findCourseById(Long id) throws IOException, BusinessException;

    /**
     * 根据id从Es索引库中删除
     * @param coursePubId id
     */
    void deleteCourse(Long coursePubId) throws IOException;

}
